package com.softaria.spkiller.layers.classificator.impl;

import java.io.IOException;
import java.util.ArrayList;
import java.util.Collection;

import com.softaria.spkiller.metadata.ClassMetaData;

public class AndPredicate implements ClassificationPredicate {

	private Collection<ClassificationPredicate> operands = new ArrayList<ClassificationPredicate>();
	
	public AndPredicate() {
		super();
	}
	
	public void addOperand(ClassificationPredicate opearnd) {
		operands.add(opearnd);
	}


	@Override
	public boolean matches(ClassMetaData metaData, ClassProbe classProbe)
			throws IOException {
		for(ClassificationPredicate operand:operands) {
			if(!operand.matches(metaData, classProbe)) {
				return false;
			}
		}
		
		return true;
	}
}
